package com.example.pureman.myapplication.aidl;

import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.IBinder;
import android.os.RemoteException;

import com.example.pureman.myapplication.IMyAidlInterface;
import com.example.pureman.myapplication.Quake;

import java.util.Date;

public class MyService extends Service {
    public MyService() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
//        throw new UnsupportedOperationException("Not yet implemented");
        return new MyServiceImpl();
    }

    public class MyServiceImpl extends IMyAidlInterface.Stub {

        @Override
        public String getValue() throws RemoteException {
            return "通过AIDL传输对象(Quake)的数据：";
        }

        @Override
        public Quake getQuake() throws RemoteException {
            Quake quake = new Quake(new Date(), "fsadf", new Location("sdfas"), 255.004, "fsaj");
            return quake;
        }

        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException {

        }
    }
}
